#define _CRT_SECURE_NO_WARNINGS 1 
#include"string.h"


void teststring1()
{
	MyString::string s1("hello world!");
	MyString::string s2("hello cplusplus");
	MyString::string s3(s1);
	MyString::string s4(s1);
	s4 = s2;
	cout << s1.c_str() << endl;
	cout << s2.c_str() << endl;
	cout << s3.c_str() << endl;
	cout << s4.c_str() << endl;
	
	
}

void teststring2()
{
	MyString::string s1("hello world!");
	MyString::string s2("hello cplusplus");
	const MyString::string s3 = "hello cplusplus";
	for (int i = 0; i < s2.size(); i++)
	{
		cout << s2[i];
	}
	cout << endl;
	s2.reserve(20);
	s2.resize(30);
	for (int i = 0; i < s2.size(); i++)
	{
		cout << s2[i];
	}
}

void teststring3()
{
	MyString::string s1("hello world!");
	MyString::string s2("hello cplusplus");
	
	//cout << s1.c_str() << endl;
	//s1.insert(2," Java.cpp ");
	//s2.insert(0, 'c');
	//s1.erase(2, 4);
	//cout << s1.c_str() << endl;
	//cout << s2.c_str() << endl;
	/*s1.swap(s2);
	cout << s1.c_str() << endl;
	cout << s2.c_str() << endl;*/

	/*cout << s1.find("world") << endl;
	cout << s1.find("llo") << endl;
	cout << s2.find("cplus") << endl;*/
	cout << s1.substr(6,100).c_str() << endl;
	cout << s2.substr(6,5).c_str() << endl;
	s1.clear();
	cout << s1.c_str() << endl;

}

void teststring4()
{
	MyString::string s1("hello world!");
	MyString::string s2("hello cplusplus!");

	string s3;
	cin >> s3;
	cout << s3 << endl;
	string s4;

	getline(cin, s4);
	cout << s4 << endl;

	s1 = s2;
	cout << s1.c_str() << endl;

}


void test() {
	MyString::string s1("hello world!");
	cout << s1.c_str() << endl;
	s1.~string();
	s1=("1111");
	cout << s1.c_str() << endl;
}
int main()
{
	test();
	return 0;
}

